const fs = require('fs');
const path = require('path');

function writeLog(writeStream, log) {
  writeStream.write(log + '\n');
}
function createWriteStream(fileName) {
  const filePath = path.join(__dirname, '../', '../', 'logs', fileName);
  const writeStream = fs.createWriteStream(filePath, {
    flag: 'a',
  });
  return writeStream;
}

const accessWriteStream = createWriteStream('access.log');

function access(log) {
  writeLog(accessWriteStream, log);
}

module.exports = {
  access,
}

